home *** CD-ROM | disk | FTP | other *** search
/ Amiga Developer CD 2.1 / Amiga Developer CD v2.1.iso / Extras / BOOPSI / GI1 / Include / intuition / gadgetclass.h < prev    next >
Encoding:
C/C++ Source or Header  |  1999-10-27  |  15.3 KB  |  479 lines

  1. #ifndef INTUITION_GADGETCLASS_H
  2. #define INTUITION_GADGETCLASS_H
  3. /*
  4. **  $Id: gadgetclass.h,v 40.0 94/02/15 18:04:14 davidj Exp Locker: davidj $
  5. **
  6. **  Custom and 'boopsi' gadget class interface
  7. **
  8. **  (C) Copyright 1989-1999 Amiga, Inc.
  9. **        All Rights Reserved
  10. */
  11.  
  12. /*****************************************************************************/
  13.  
  14. #ifndef EXEC_TYPES_H
  15. #include <exec/types.h>
  16. #endif
  17.  
  18. #ifndef INTUITION_INTUITION_H
  19. #include <intuition/intuition.h>
  20. #endif
  21.  
  22. #ifndef UTILITY_TAGITEM_H
  23. #include <utility/tagitem.h>
  24. #endif
  25.  
  26. /*****************************************************************************/
  27.  
  28. /* NOTE:  <intuition/iobsolete.h> is included at the END of this file! */
  29.  
  30. /*****************************************************************************/
  31.  
  32. /* Gadget class attributes */
  33. #define    GA_Dummy         (TAG_USER+0x30000)
  34.  
  35. #define    GA_Left            (GA_Dummy+1)
  36.     /* (LONG) Left edge of the gadget relative to the left edge of
  37.      * the window */
  38.  
  39. #define    GA_RelRight        (GA_Dummy+2)
  40.     /* (LONG) Left edge of the gadget relative to the right edge of
  41.      * the window */
  42.  
  43. #define    GA_Top            (GA_Dummy+3)
  44.     /* (LONG) Top edge of the gadget relative to the top edge of
  45.      * the window */
  46.  
  47. #define    GA_RelBottom        (GA_Dummy+4)
  48.     /* (LONG) Top edge of the gadget relative to the bottom edge
  49.      * of the window */
  50.  
  51. #define    GA_Width        (GA_Dummy+5)
  52.     /* (LONG) Width of the gadget */
  53.  
  54. #define    GA_RelWidth        (GA_Dummy+6)
  55.     /* (LONG) Width of the gadget relative to the width of the
  56.      * window */
  57.  
  58. #define    GA_Height        (GA_Dummy+7)
  59.     /* (LONG) Height of the gadget */
  60.  
  61. #define    GA_RelHeight        (GA_Dummy+8)
  62.     /* (LONG) Height of the gadget relative to the height of
  63.      * the window */
  64.  
  65. #define    GA_Text            (GA_Dummy+9)
  66.     /* (STRPTR) Gadget imagry is NULL terminated string */
  67.  
  68. #define    GA_Image        (GA_Dummy+10)
  69.     /* (struct Image *) Gadget imagry is an image */
  70.  
  71. #define    GA_Border        (GA_Dummy+11)
  72.     /* (struct Border *) Gadget imagry is a border */
  73.  
  74. #define    GA_SelectRender        (GA_Dummy+12)
  75.     /* (struct Image *) Selected gadget imagry */
  76.  
  77. #define    GA_Highlight        (GA_Dummy+13)
  78.     /* (UWORD) One of GFLG_GADGHNONE, GFLG_GADGHBOX, GFLG_GADGHCOMP,
  79.      * or GFLG_GADGHIMAGE */
  80.  
  81. #define    GA_Disabled        (GA_Dummy+14)
  82.     /* (BOOL) Indicate whether gadget is disabled or not.
  83.      * Defaults to FALSE. */
  84.  
  85. #define    GA_GZZGadget        (GA_Dummy+15)
  86.     /* (BOOL) Indicate whether the gadget is for
  87.      * WFLG_GIMMEZEROZERO window borders or not.  Defaults
  88.      * to FALSE. */
  89.  
  90. #define    GA_ID            (GA_Dummy+16)
  91.     /* (UWORD) Gadget ID assigned by the application */
  92.  
  93. #define    GA_UserData        (GA_Dummy+17)
  94.     /* (APTR) Application specific data */
  95.  
  96. #define    GA_SpecialInfo        (GA_Dummy+18)
  97.     /* (APTR) Gadget specific data */
  98.  
  99. #define    GA_Selected        (GA_Dummy+19)
  100.     /* (BOOL) Indicate whether the gadget is selected or not.
  101.      * Defaults to FALSE */
  102.  
  103. #define    GA_EndGadget        (GA_Dummy+20)
  104.     /* (BOOL) When set tells the system that when this gadget
  105.      * is selected causes the requester that it is in to be
  106.      * ended.  Defaults to FALSE. */
  107.  
  108. #define    GA_Immediate        (GA_Dummy+21)
  109.     /* (BOOL) When set indicates that the gadget is to
  110.      * notify the application when it becomes active.  Defaults
  111.      * to FALSE. */
  112.  
  113. #define    GA_RelVerify        (GA_Dummy+22)
  114.     /* (BOOL) When set indicates that the application wants to
  115.      * verify that the pointer was still over the gadget when
  116.      * the select button is released.  Defaults to FALSE. */
  117.  
  118. #define    GA_FollowMouse        (GA_Dummy+23)
  119.     /* (BOOL) When set indicates that the application wants to
  120.      * be notified of mouse movements while the gadget is active.
  121.      * It is recommmended that GA_Immediate and GA_RelVerify are
  122.      * also used so that the active gadget can be tracked by the
  123.      * application.  Defaults to FALSE. */
  124.  
  125. #define    GA_RightBorder        (GA_Dummy+24)
  126.     /* (BOOL) Indicate whether the gadget is in the right border
  127.      * or not.  Defaults to FALSE. */
  128.  
  129. #define    GA_LeftBorder        (GA_Dummy+25)
  130.     /* (BOOL) Indicate whether the gadget is in the left border
  131.      * or not.  Defaults to FALSE. */
  132.  
  133. #define    GA_TopBorder        (GA_Dummy+26)
  134.     /* (BOOL) Indicate whether the gadget is in the top border
  135.      * or not.  Defaults to FALSE. */
  136.  
  137. #define    GA_BottomBorder        (GA_Dummy+27)
  138.     /* (BOOL) Indicate whether the gadget is in the bottom border
  139.      * or not.  Defaults to FALSE. */
  140.  
  141. #define    GA_ToggleSelect        (GA_Dummy+28)
  142.     /* (BOOL) Indicate whether the gadget is toggle-selected
  143.      * or not.  Defaults to FALSE. */
  144.  
  145. #define    GA_SysGadget        (GA_Dummy+29
  146.     /* (BOOL) Reserved for system use to indicate that the
  147.      * gadget belongs to the system.  Defaults to FALSE. */
  148.  
  149. #define    GA_SysGType        (GA_Dummy+30)
  150.     /* (UWORD) Reserved for system use to indicate the
  151.      * gadget type. */
  152.  
  153. #define    GA_Previous        (GA_Dummy+31)
  154.     /* (struct Gadget *) Previous gadget in the linked list.
  155.      * NOTE: This attribute CANNOT be used to link new gadgets
  156.      * into the gadget list of an open window or requester.
  157.      * You must use AddGList(). */
  158.  
  159. #define    GA_Next            (GA_Dummy+32)
  160.     /* (struct Gadget *) Next gadget in the linked list. */
  161.  
  162. #define    GA_DrawInfo        (GA_Dummy+33)
  163.     /* (struct DrawInfo *) Some gadgets need a DrawInfo at creation time */
  164.  
  165. /* You should use at most ONE of GA_Text, GA_IntuiText, and GA_LabelImage */
  166. #define GA_IntuiText        (GA_Dummy+34)
  167.     /* (struct IntuiText *) Label is an IntuiText. */
  168.  
  169. #define GA_LabelImage        (GA_Dummy+35)
  170.     /* (Object *) Label is an image object. */
  171.  
  172. #define GA_TabCycle        (GA_Dummy+36)
  173.     /* (BOOL) Indicate whether gadget is part of TAB/SHIFT-TAB cycle
  174.      * activation.  Defaults to FALSE.  New for V37. */
  175.  
  176. #define GA_GadgetHelp        (GA_Dummy+37)
  177.     /* (BOOL) Indicate whether gadget is to send IDCMP_GADGETHELP.
  178.      * Defaults to FALSE.  New for V39. */
  179.  
  180. #define GA_Bounds        (GA_Dummy+38)
  181.     /* (struct IBox *) Copied into the extended gadget's bounds.
  182.      * New for V39. */
  183.  
  184. #define GA_RelSpecial        (GA_Dummy+39)
  185.     /* (BOOL) Indicate whether gadget has special relativity.  Defaults to
  186.      * FALSE.  New for V39. */
  187.  
  188. #define    GA_TextAttr        (GA_Dummy+40)
  189.     /* (struct TextAttr *) Indicate the font to use for the gadget.
  190.      * New for V42. */
  191.  
  192. #define    GA_ReadOnly        (GA_Dummy+41)
  193.     /* (BOOL) Indicate that the gadget is read-only (non-selectable).
  194.      * Defaults to FALSE. New for V42. */
  195.  
  196. /*****************************************************************************/
  197.  
  198. /* PROPGCLASS attributes */
  199. #define PGA_Dummy    (TAG_USER+0x31000)
  200. #define PGA_Freedom    (PGA_Dummy+0x0001)
  201.     /* only one of FREEVERT or FREEHORIZ */
  202. #define PGA_Borderless    (PGA_Dummy+0x0002)
  203. #define PGA_HorizPot    (PGA_Dummy+0x0003)
  204. #define PGA_HorizBody    (PGA_Dummy+0x0004)
  205. #define PGA_VertPot    (PGA_Dummy+0x0005)
  206. #define PGA_VertBody    (PGA_Dummy+0x0006)
  207. #define PGA_Total    (PGA_Dummy+0x0007)
  208. #define PGA_Visible    (PGA_Dummy+0x0008)
  209. #define PGA_Top        (PGA_Dummy+0x0009)
  210. /* New for V37: */
  211. #define PGA_NewLook    (PGA_Dummy+0x000A)
  212.  
  213. /*****************************************************************************/
  214.  
  215. /* STRGCLASS attributes */
  216. #define STRINGA_Dummy          (TAG_USER     +0x32000)
  217. #define STRINGA_MaxChars    (STRINGA_Dummy+0x0001)
  218. /* Note:  There is a minor problem with Intuition when using boopsi integer
  219.  * gadgets (which are requested by using STRINGA_LongInt).  Such gadgets
  220.  * must not have a STRINGA_MaxChars to be bigger than 15.  Setting
  221.  * STRINGA_MaxChars for a boopsi integer gadget will cause a mismatched
  222.  * FreeMem() to occur.
  223.  */
  224.  
  225. #define STRINGA_Buffer        (STRINGA_Dummy+0x0002)
  226. #define STRINGA_UndoBuffer    (STRINGA_Dummy+0x0003)
  227. #define STRINGA_WorkBuffer    (STRINGA_Dummy+0x0004)
  228. #define STRINGA_BufferPos    (STRINGA_Dummy+0x0005)
  229. #define STRINGA_DispPos        (STRINGA_Dummy+0x0006)
  230. #define STRINGA_AltKeyMap    (STRINGA_Dummy+0x0007)
  231. #define STRINGA_Font        (STRINGA_Dummy+0x0008)
  232. #define STRINGA_Pens        (STRINGA_Dummy+0x0009)
  233. #define STRINGA_ActivePens    (STRINGA_Dummy+0x000A)
  234. #define STRINGA_EditHook    (STRINGA_Dummy+0x000B)
  235. #define STRINGA_EditModes    (STRINGA_Dummy+0x000C)
  236.  
  237. /* booleans */
  238. #define STRINGA_ReplaceMode    (STRINGA_Dummy+0x000D)
  239. #define STRINGA_FixedFieldMode    (STRINGA_Dummy+0x000E)
  240. #define STRINGA_NoFilterMode    (STRINGA_Dummy+0x000F)
  241.  
  242. #define STRINGA_Justification    (STRINGA_Dummy+0x0010)
  243.     /* GACT_STRINGCENTER, GACT_STRINGLEFT, GACT_STRINGRIGHT */
  244. #define STRINGA_LongVal        (STRINGA_Dummy+0x0011)
  245. #define STRINGA_TextVal        (STRINGA_Dummy+0x0012)
  246.  
  247. #define STRINGA_ExitHelp    (STRINGA_Dummy+0x0013)
  248.     /* STRINGA_ExitHelp is new for V37, and ignored by V36.
  249.      * Set this if you want the gadget to exit when Help is
  250.      * pressed.  Look for a code of 0x5F, the rawkey code for Help */
  251.  
  252. #define SG_DEFAULTMAXCHARS    (128)
  253.  
  254. /*****************************************************************************/
  255.  
  256. /* Gadget layout related attributes */
  257. #define    LAYOUTA_Dummy         (TAG_USER+0x38000)
  258. #define LAYOUTA_LayoutObj    (LAYOUTA_Dummy+0x0001)
  259. #define LAYOUTA_Spacing        (LAYOUTA_Dummy+0x0002)
  260. #define LAYOUTA_Orientation    (LAYOUTA_Dummy+0x0003)
  261.  
  262. #define    LAYOUTA_ChildMaxWidth    (LAYOUTA_Dummy+0x0004)
  263.     /* (BOOL) Child objects are of equal width.  Should default to TRUE for
  264.      * gadgets with a horizontal orientation.  New for V42. */
  265. #define    LAYOUTA_ChildMaxHeight    (LAYOUTA_Dummy+0x0005)
  266.     /* (BOOL) Child objects are of equal height.  Should default to TRUE for
  267.      * gadgets with a vertical orientation.  New for V42. */
  268.  
  269. /* orientation values */
  270. #define LORIENT_NONE    0
  271. #define LORIENT_HORIZ    1
  272. #define LORIENT_VERT    2
  273.  
  274. /*****************************************************************************/
  275.  
  276. /* Gadget Method ID's */
  277. #define GM_Dummy    (-1)
  278.     /* not used for anything */
  279.  
  280. #define GM_HITTEST    (0)
  281.     /* return GMR_GADGETHIT if you are clicked on (whether or not you
  282.      * are disabled). */
  283.  
  284. #define GM_RENDER    (1)
  285.     /* draw yourself, in the appropriate state */
  286.  
  287. #define GM_GOACTIVE    (2)
  288.     /* you are now going to be fed input */
  289.  
  290. #define GM_HANDLEINPUT    (3)
  291.     /* handle that input */
  292.  
  293. #define GM_GOINACTIVE    (4)
  294.     /* whether or not by choice, you are done */
  295.  
  296. #define GM_HELPTEST    (5)
  297.     /* Will you send gadget help if the mouse is at the specified coordinates?
  298.      * See below for possible GMR_ values. */
  299.  
  300. #define GM_LAYOUT    (6)
  301.     /* re-evaluate your size based on the GadgetInfo domain.
  302.      * Do NOT re-render yourself yet, you will be called when it is
  303.      * time... */
  304.  
  305. #define GM_DOMAIN    (7)
  306.     /* Used to obtain the sizing requirements of an object.  Does not
  307.      * require an object. */
  308.  
  309. /*****************************************************************************/
  310.  
  311. /* Parameter "Messages" passed to gadget class methods    */
  312.  
  313. /* GM_HITTEST and GM_HELPTEST send this message.
  314.  * For GM_HITTEST, gpht_Mouse are coordinates relative to the gadget
  315.  * select box.  For GM_HELPTEST, the coordinates are relative to
  316.  * the gadget bounding box (which defaults to the select box).
  317.  */
  318. struct gpHitTest
  319. {
  320.     ULONG        MethodID;
  321.     struct GadgetInfo    *gpht_GInfo;
  322.     struct
  323.     {
  324.     WORD    X;
  325.     WORD    Y;
  326.     }            gpht_Mouse;
  327. };
  328.  
  329. /* For GM_HITTEST, return GMR_GADGETHIT if you were indeed hit,
  330.  * otherwise return zero.
  331.  *
  332.  * For GM_HELPTEST, return GMR_NOHELPHIT (zero) if you were not hit.
  333.  * Typically, return GMR_HELPHIT if you were hit.
  334.  * It is possible to pass a UWORD to the application via the Code field
  335.  * of the IDCMP_GADGETHELP message.  Return GMR_HELPCODE or'd with
  336.  * the UWORD-sized result you wish to return.
  337.  *
  338.  * GMR_HELPHIT yields a Code value of ((UWORD) ~0), which should
  339.  * mean "nothing particular" to the application.
  340.  */
  341.  
  342. #define GMR_GADGETHIT    (0x00000004)    /* GM_HITTEST hit */
  343.  
  344. #define GMR_NOHELPHIT    (0x00000000)    /* GM_HELPTEST didn't hit */
  345. #define GMR_HELPHIT    (0xFFFFFFFF)    /* GM_HELPTEST hit, return code = ~0 */
  346. #define GMR_HELPCODE    (0x00010000)    /* GM_HELPTEST hit, return low word as code */
  347.  
  348. /*****************************************************************************/
  349.  
  350. /* GM_RENDER    */
  351. struct gpRender
  352. {
  353.     ULONG        MethodID;
  354.     struct GadgetInfo    *gpr_GInfo;    /* gadget context        */
  355.     struct RastPort    *gpr_RPort;    /* all ready for use        */
  356.     LONG        gpr_Redraw;    /* might be a "highlight pass"    */
  357. };
  358.  
  359. /* values of gpr_Redraw    */
  360. #define GREDRAW_UPDATE    (2)    /* incremental update, e.g. prop slider    */
  361. #define GREDRAW_REDRAW    (1)    /* redraw gadget    */
  362. #define GREDRAW_TOGGLE    (0)    /* toggle highlight, if applicable    */
  363.  
  364. /*****************************************************************************/
  365.  
  366. /* GM_GOACTIVE, GM_HANDLEINPUT    */
  367. struct gpInput
  368. {
  369.     ULONG        MethodID;
  370.     struct GadgetInfo    *gpi_GInfo;
  371.     struct InputEvent    *gpi_IEvent;
  372.     LONG        *gpi_Termination;
  373.     struct
  374.     {
  375.     WORD    X;
  376.     WORD    Y;
  377.     }            gpi_Mouse;
  378.  
  379.     /* (V39) Pointer to TabletData structure, if this event originated
  380.      * from a tablet which sends IESUBCLASS_NEWTABLET events, or NULL if
  381.      * not.
  382.      *
  383.      * DO NOT ATTEMPT TO READ THIS FIELD UNDER INTUITION PRIOR TO V39!
  384.      * IT WILL BE INVALID!
  385.      */
  386.     struct TabletData    *gpi_TabletData;
  387. };
  388.  
  389. /* GM_HANDLEINPUT and GM_GOACTIVE  return code flags    */
  390. /* return GMR_MEACTIVE (0) alone if you want more input.
  391.  * Otherwise, return ONE of GMR_NOREUSE and GMR_REUSE, and optionally
  392.  * GMR_VERIFY.
  393.  */
  394. #define GMR_MEACTIVE    (0)
  395. #define GMR_NOREUSE    (1 << 1)
  396. #define GMR_REUSE    (1 << 2)
  397. #define GMR_VERIFY    (1 << 3)    /* you MUST set gpi_Termination */
  398.  
  399. /* New for V37:
  400.  * You can end activation with one of GMR_NEXTACTIVE and GMR_PREVACTIVE,
  401.  * which instructs Intuition to activate the next or previous gadget
  402.  * that has GFLG_TABCYCLE set.
  403.  */
  404. #define GMR_NEXTACTIVE    (1 << 4)
  405. #define GMR_PREVACTIVE    (1 << 5)
  406.  
  407. /*****************************************************************************/
  408.  
  409. /* GM_GOINACTIVE */
  410. struct gpGoInactive
  411. {
  412.     ULONG        MethodID;
  413.     struct GadgetInfo    *gpgi_GInfo;
  414.  
  415.     /* V37 field only!  DO NOT attempt to read under V36! */
  416.     ULONG        gpgi_Abort;    /* gpgi_Abort=1 if gadget was aborted
  417.                      * by Intuition and 0 if gadget went
  418.                      * inactive at its own request
  419.                      */
  420. };
  421.  
  422. /*****************************************************************************/
  423.  
  424. /* New for V39: Intuition sends GM_LAYOUT to any GREL_ gadget when
  425.  * the gadget is added to the window (or when the window opens, if
  426.  * the gadget was part of the NewWindow.FirstGadget or the WA_Gadgets
  427.  * list), or when the window is resized.  Your gadget can set the
  428.  * GA_RelSpecial property to get GM_LAYOUT events without Intuition
  429.  * changing the interpretation of your gadget select box.  This
  430.  * allows for completely arbitrary resizing/repositioning based on
  431.  * window size.
  432.  */
  433. /* GM_LAYOUT */
  434. struct gpLayout
  435. {
  436.     ULONG        MethodID;
  437.     struct GadgetInfo    *gpl_GInfo;
  438.     ULONG        gpl_Initial;    /* non-zero if this method was invoked
  439.                      * during AddGList() or OpenWindow()
  440.                      * time.  zero if this method was invoked
  441.                      * during window resizing. */
  442. };
  443.  
  444. /*****************************************************************************/
  445.  
  446. /* The GM_DOMAIN method is used to obtain the sizing requirements of an
  447.  * object for a class before ever creating an object. */
  448.  
  449. /* GM_DOMAIN */
  450. struct gpDomain
  451. {
  452.     ULONG         MethodID;
  453.     struct GadgetInfo    *gpd_GInfo;
  454.     struct RastPort    *gpd_RPort;    /* RastPort to layout for */
  455.     LONG         gpd_Which;
  456.     struct IBox         gpd_Domain;    /* Resulting domain */
  457.     struct TagItem    *gpd_Attrs;    /* Additional attributes */
  458. };
  459.  
  460. #define    GDOMAIN_MINIMUM        (0)
  461.     /* Minimum size */
  462.  
  463. #define    GDOMAIN_NOMINAL        (1)
  464.     /* Nominal size */
  465.  
  466. #define    GDOMAIN_MAXIMUM        (2)
  467.     /* Maximum size */
  468.  
  469. /*****************************************************************************/
  470.  
  471. /* Include obsolete identifiers: */
  472. #ifndef INTUITION_IOBSOLETE_H
  473. #include <intuition/iobsolete.h>
  474. #endif
  475.  
  476. /*****************************************************************************/
  477.  
  478. #endif
  479.